<template>
	<view class="u-content">
		<u-parse :content="content"></u-parse>
	</view>
</template>

<script>
	import {
		getArticleInfo,
		getArticleViewShow
	} from '@/api'
	export default {
		onLoad(e) {
			this.setTitle(e.title)
			this.getInfo(e.id)
			this.setView(e.id)
		},
		data() {
			return {
				content: ''
			}
		},
		methods: {
			async getInfo(id) {
				const {
					code,
					data: {
						content
					}
				} = await getArticleInfo({
					id
				})
				if (code === 1) {
					this.content = content
				}
			},
			setTitle(title) {
				uni.setNavigationBarTitle({
					title
				})
			},
			async setView(id) {
				await getArticleViewShow({
					id
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.u-content {
		padding: 24rpx;
	}
</style>